 function check(form,item)
    {
       
		if(item=='username')
		{
			if(form.username.value=="")
			{
			 	username1.innerHTML ="<font color=#FF0000>*请输入用户名</font>";
				return false;
			}
		}
		else if(item=='email')
		{
			if(form.email.value=="")
			{
				email1.innerHTML="<font color=#FF0000>*请输入邮箱</font>";
				return false;
			}
		}
		else if(item=='captcha')
		{
			if(form.captcha.value.length<4)
			{
				captcha1.innerHTML="<font color=#FF0000></font>";
				return false;
			}
			if(form.captcha.value.length>4)
			{
				captcha1.innerHTML="<font color=#FF0000>*验证码不正确</font>";
				return false;
			}
		}

		var username=form.username.value;
		var email=form.email.value;
		var captcha=form.captcha.value;
		var password=form.password.value;
		//alert(password);
		var url=BASE_HOSTPATH+"/dr-includes/dr-ajax-register.php";

		var xmlhttp=false;
		if(window.ActiveXObject)
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		else if(window.XMLHttpRequest)
			xmlhttp=new XMLHttpRequest();
		if(!xmlhttp)
		{
			alert("不能创建XMLHTTP实例");
			return false;
		}

		xmlhttp.open("POST",url,true);
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange=function()
		{
			if(xmlhttp.readyState==4)
			{
				//alert("hello");
				var msg=xmlhttp.responseText;
				if(msg==0)
				{
					username1.innerHTML="<font color=#FF0000>*用户名已存在！</font>";
					form.agree.checked=false;
					form.submit.disabled=true;
					form.username_h.value="not";
					return false;
				}
				else if(msg==1)
				{
					email1.innerHTML="<font color=#FF0000>*邮箱格式不正确！</font>";
					form.agree.checked=false;
					form.submit.disabled=true;
					form.email_h.value="not";
					return false;
				}
				else if(msg==2)
				{
					email1.innerHTML="<font color=#FF0000>*邮箱已存在！</font>";
					form.agree.checked=false;
					form.email_h.value="not";
					return false;
				}
				else if(msg==3)
				{
					captcha1.innerHTML="<font color=#FF0000>*验证码不正确</font>";
					form.agree.checked=false;
					form.submit.disabled=true;
					form.captcha_h.value="not";
					return false;
				}
				else if(msg==4)
				{
					password1.innerHTML ="<font color=#FF0000>*密码包含非法字符（只能包含数字、字母和标点符号）</font>";
					return false;
				}
				else if(msg==5)
				{
					username1.innerHTML="<font color=#FF0000>*用户名不得少于6个字符！</font>";
					form.agree.checked=false;
					form.submit.disabled=true;
					form.username_h.value="not";
					return false;
				}

				else if(msg==10)
				{
					username1.innerHTML="<font color=#00FF00>恭喜您，用户名可用。</font>";
					form.username_h.value="yes";
					return true;
				}
				else if(msg==11)
				{
					email1.innerHTML="<font color=#00FF00>恭喜您，邮箱可用。</font>";
					form.email_h.value="yes";
					return true;
				}
				else if(msg==12)
				{
					captcha1.innerHTML="<font color=#00FF00>验证码正确。</font>";
					form.captcha_h.value="yes";
					return true;
				}
				else if(msg==13)
				{
					return true;
				}

				else
				{
					//email1.innerHTML="<font color=#FF0000>*未知错误。。。</font>";
					return false;
				}
			}
		}
		if(item=='username')
			result="username="+username;
		else if(item=='email')
			result="email="+email;
		else if(item=='captcha')
			result="captcha="+captcha;
		else if(item=='password')
			result="password="+password;

		result+="&nocache="+new Date().getTime();
		xmlhttp.send(result);
	}


	function checkpassword(form,item)
	{
		if(item=='password')
		{
			if(form.password.value=="")
			{
			 	password1.innerHTML ="<font color=#FF0000>*请输入密码</font>";
				return false;
			}
			else if(form.password.value.length<6)
			{
				password1.innerHTML ="<font color=#FF0000>*密码长度不得小于6位</font>";
				return false;
			}
			else
			{
				if(check(form,item)==false)
					return false;
			}
			
			
			if(form.repassword.value!="" && form.password.value!=form.repassword.value)
			{
				repassword1.innerHTML="<font color=#FF0000>*两次密码输入不正确</font>";
				form.agree.checked=false;
				form.submit.disabled=true;
				form.repassword_h.value="not";
				return false;
			}
			else
			{
				password1.innerHTML ="<font color=#00FF00>已通过</font>";
				return true;

			}

		}
		if(item=='repassword')
		{
			if(form.repassword.value=="")
			{
				repassword1.innerHTML="<font color=#FF0000>*请重复输入密码</font>";
				form.agree.checked=false;
				form.submit.disabled=true;
				form.repassword_h.value="not";
				return false;
			}
			else if(form.repassword.value!=form.password.value)
			{
				repassword1.innerHTML="<font color=#FF0000>*两次密码输入不正确</font>";
				form.agree.checked=false;
				form.submit.disabled=true;
				form.repassword_h.value="not";
				return false;
			}
			else
			{
				repassword1.innerHTML ="<font color=#00FF00>已通过</font>";
				form.repassword_h.value="yes";
				return true;
			}
		}
	}

	function checksubmit(form)
	{
		if(form.username.value==""||form.email.value==""||form.repassword.value==""||form.repassword.value==""||form.captcha.value=="")
		{
			form.agree.checked=false;
			alert("请先填写完上面的信息。。。");
			return false;
		}
		else if(form.username_h.value=="yes"&&form.email_h.value=="yes"&&form.repassword_h.value=="yes"&&form.captcha_h.value=="yes")
		{
			if(form.agree.checked==true)
				form.submit.disabled=false;
			else
				form.submit.disabled=true;
		}
		else
		{
			form.agree.checked=false;
			alert("注册信息输入有误，请确认检查");
			return false;
		}
	}

    function checkcaptcha(form)
    {
    	if(form.captcha.value.length<4)
    	{
    		captcha1.innerHTML="<font color=#FF0000>*验证码不正确</font>";
    		return false;
    	}
    
    }
